/*
 * File:   EditGUI.cpp
 * Author: alrojas
 *
 * Created on 17 de junio de 2014, 13:02
 */

#include <qt4/QtGui/qlayout.h>

#include "EditGUI.h"

EditGUI::EditGUI(QImage image){
    
    setWindowTitle("Edit Window");
    layout = new QGridLayout(this);
        
    createObjects(image);
    
}

void EditGUI::createObjects(QImage image) {
    

    this->toolTBar = new QToolBar();
    
    this->drawTBut = new QToolButton();
            drawTBut->setIcon(QIcon("images/draw.PNG"));
    drawTBut->setIconSize(QSize(256,256));
    
            this->moveTBut = new QToolButton();
            moveTBut->setIcon(QIcon("images/move.PNG"));
                moveTBut->setIconSize(QSize(256,256));
    this->rotateTBut = new QToolButton();
            rotateTBut->setIcon(QIcon("images/rotate.PNG"));
                rotateTBut->setIconSize(QSize(256,256));
                
    toolTBar->addWidget(drawTBut);
    toolTBar->addSeparator();
    toolTBar->addWidget(moveTBut);
    toolTBar->addSeparator();
    toolTBar->addWidget(rotateTBut);
    toolTBar->setIconSize(QSize(48,48));
    
    layout->addWidget(toolTBar,0,0);
    
    /* Sheet Group */
    /* Sheet Group */
    sheetGro = new QGroupBox("Preview",this);
    sheetLay = new QBoxLayout(QBoxLayout::LeftToRight,sheetGro);
    sheetGro->setLayout(sheetLay);
    
    sheetScr = new QScrollArea(sheetGro);
    sheetLab = new QLabel(sheetScr);
    sheetLab->setPixmap(QPixmap::fromImage(image));
    
    sheetScr->setBackgroundRole(QPalette::Dark);
    sheetScr->setWidget(sheetLab);
    sheetScr->setAlignment(Qt::AlignCenter);
    
    sheetLab->setBackgroundRole(QPalette::Base);
    sheetLab->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    sheetLab->setScaledContents(true);
    sheetLay->addWidget(sheetScr);
    
    layout->addWidget(sheetGro,1,0);
    //sheetLay->addWidget(sheetScr);
    
    
    this->setLayout(layout);
    
}

